#include <stdio.h>

typedef struct {
  int n;
  char name[21];
} Line;

int read_line(const char *file, const Line *line);

int main(int argc, char *argv[]) {
Line line;

if(argc!=2) {
  fprintf(stderr,"ERROR: useage: %s <test-file>\n", argv[0]);
  exit(1);
}

read_line(argv[1], &line);

printf("n=%d    name=\\%s\\\n", line.n, line.name);
exit(0);
}

int read_line(const char *file, const Line *line) {
FILE *fp;
if((fp=fopen(file, "r")) == NULL) {
  fprintf(stderr,"ERROR: can not open %s\n", file);
  exit(1);
}
if(fscanf(fp,"%d %20s", &line->n, &line->name) !=2) {
  fprintf(stderr,"ERROR: can not read \"<n> <name>\" from %s\n", file);
  exit(1);
}
return(0);
}
